package com.cxhc.app.api.hcdoc;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.cxhc.system.domain.hcdoc.HdParkMonthly;
import com.cxhc.system.service.hcdoc.IHdParkMonthlyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.cxhc.common.core.controller.BaseController;
import com.cxhc.common.core.domain.AjaxResult;
import com.cxhc.common.utils.poi.ExcelUtil;
import com.cxhc.common.core.page.TableDataInfo;

/**
 * 停车包月信息Controller
 * 
 * @author Dhq
 * @date 2024-09-26
 */
@RestController
@RequestMapping("/api/hcDoc/parkMonthly")
public class HdParkMonthlyController extends BaseController
{
    @Autowired
    private IHdParkMonthlyService hdParkMonthlyService;

    /**
     * 查询停车包月信息列表
     */
    @GetMapping("/list")
    public TableDataInfo list(HdParkMonthly hdParkMonthly)
    {
        startPage();
        List<HdParkMonthly> list = hdParkMonthlyService.selectHdParkMonthlyList(hdParkMonthly);
        return getDataTable(list);
    }

    /**
     * 查询停车包月信息列表
     */
    @GetMapping("/amount")
    public AjaxResult amount()
    {
        return success(hdParkMonthlyService.amount());
    }

    /**
     * 导出停车包月信息列表
     */
    @GetMapping("/export")
    public void export(HttpServletResponse response, HdParkMonthly hdParkMonthly)
    {
        List<HdParkMonthly> list = hdParkMonthlyService.selectHdParkMonthlyList(hdParkMonthly);
        ExcelUtil<HdParkMonthly> util = new ExcelUtil<HdParkMonthly>(HdParkMonthly.class);
        util.exportExcel(response, list, "停车包月信息数据");
    }

    /**
     * 获取停车包月信息详细信息
     */
    @GetMapping(value = "/detail/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(hdParkMonthlyService.selectHdParkMonthlyById(id));
    }

    /**
     * 新增停车包月信息
     */
    @PostMapping("/insert")
    public AjaxResult add(@RequestBody HdParkMonthly hdParkMonthly)
    {
        return toAjax(hdParkMonthlyService.insertHdParkMonthly(hdParkMonthly));
    }

    /**
     * 修改停车包月信息
     */
    @PostMapping("/update")
    public AjaxResult edit(@RequestBody HdParkMonthly hdParkMonthly)
    {
        return toAjax(hdParkMonthlyService.updateHdParkMonthly(hdParkMonthly));
    }

    /**
     * 删除停车包月信息
     */
    @GetMapping(value = "/delete/{id}")
    public AjaxResult remove(@PathVariable Long id)
    {
        return toAjax(hdParkMonthlyService.deleteHdParkMonthlyById(id));
    }
}
